﻿using System;
using System.Text;
using System.Data;
using System.IO;

namespace ConvertTools
{
    public class DatabaseParamCls
    {
        public string PrefixTable;
        public string FieldName;
        public SqlDbType FieldType;
        public object Value;
        public bool Allow = true;
        public bool UseLikeQuery = false;

        public DatabaseParamCls()
        {
        }

        public DatabaseParamCls(string _PrefixTable, string _FieldName, SqlDbType _FieldType, object _Value)
        {
            PrefixTable = _PrefixTable;
            FieldName = _FieldName;
            FieldType = _FieldType;
            Value = _Value;
        }

        public DatabaseParamCls(string _FieldName, SqlDbType _FieldType, object _Value)
        {
            FieldName = _FieldName;
            FieldType = _FieldType;
            Value = _Value;
        }

        public DatabaseParamCls(string _FieldName, object _Value)
        {
            FieldName = _FieldName;
            FieldType = SqlDbType.NVarChar;// DatabaseFieldType.d_string;
            Value = _Value;
        }


        public DatabaseParamCls(string _PrefixTable, string _FieldName, object _Value)
        {
            PrefixTable = _PrefixTable;
            FieldName = _FieldName;
            FieldType = SqlDbType.NVarChar;// DatabaseFieldType.d_string;
            Value = _Value;
        }

        public DatabaseParamCls(string _FieldName, object _Value, bool _UseLikeQuery)
        {
            FieldName = _FieldName;
            FieldType = SqlDbType.NVarChar;// DatabaseFieldType.d_string;
            Value = _Value;
            UseLikeQuery = _UseLikeQuery;
        }


        public DatabaseParamCls(string _PrefixTable, string _FieldName, object _Value, bool _UseLikeQuery)
        {
            PrefixTable = _PrefixTable;
            FieldName = _FieldName;
            FieldType = SqlDbType.NVarChar;// DatabaseFieldType.d_string;
            Value = _Value;
            UseLikeQuery = _UseLikeQuery;
        }
        public string GetField
        {
            get
            {
                string rValue = PrefixTable;
                if (!string.IsNullOrEmpty(PrefixTable))
                {
                    rValue = rValue + ".";
                }
                rValue += FieldName;
                return rValue;
            }
        }
    }
}
